package com.作业.Day15;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class Homework5 {
    public static void main(String[] args) throws IOException {
        try (FileReader fileReader = new FileReader("text4.txt");
             FileWriter fileWriter = new FileWriter("text6.txt")) {
            char[] chars = new char[2];
            int len=0;
            while (( len=fileReader.read(chars))!=-1){
                System.out.print(new String(chars,0,len));
                fileWriter.write(chars);
            }



        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }

    }
}
